package createpattern.abstractfactory;

/**
 * 工厂生产着
 *
 * @author seer
 * @date 2018/2/5 14:07
 */
public class FactoryProducer {
    public static <T> T getFactory(Class<? extends AbstractFactory> clazz) {
        if (ShapeFactory.class.isAssignableFrom(clazz)) {
            return ((T) new ShapeFactory());
        }
        if (ColorFactory.class.isAssignableFrom(clazz)) {
            return ((T) new ColorFactory());
        }
        return null;
    }
}
